home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / mach / thread_info.h < prev    next >
Text File  |  1995-02-14  |  5KB  |  155 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    thread_info.h,v $
  29.  * Revision 2.5  93/01/14  17:47:57  danner
  30.  *     Cleanup.
  31.  *     [92/06/10            pds]
  32.  *     64bit cleanup.
  33.  *     [92/12/01            af]
  34.  * 
  35.  * Revision 2.4  91/05/14  17:01:06  mrt
  36.  *     Correcting copyright
  37.  * 
  38.  * Revision 2.3  91/02/05  17:36:34  mrt
  39.  *     Changed to new Mach copyright
  40.  *     [91/02/01  17:21:39  mrt]
  41.  * 
  42.  * Revision 2.2  90/06/02  15:00:08  rpd
  43.  *     Updated for new scheduling info.
  44.  *     [90/03/26  22:40:55  rpd]
  45.  * 
  46.  * Revision 2.1  89/08/03  16:06:07  rwd
  47.  * Created.
  48.  * 
  49.  * Revision 2.4  89/02/25  18:41:18  gm0w
  50.  *     Changes for cleanup.
  51.  * 
  52.  *  4-Mar-88  David Black (dlb) at Carnegie-Mellon University
  53.  *    Added TH_USAGE_SCALE for cpu_usage field.
  54.  *
  55.  * 15-Jan-88  David Golub (dbg) at Carnegie-Mellon University
  56.  *    Changed to generic interface (variable-length array) to allow
  57.  *    for expansion.  Renamed to thread_info.
  58.  *
  59.  *  1-Jun-87  Avadis Tevanian (avie) at Carnegie-Mellon University
  60.  *    Created.
  61.  *
  62.  */
  63. /*
  64.  *    File:    mach/thread_info
  65.  *
  66.  *    Thread information structure and definitions.
  67.  *
  68.  *    The defintions in this file are exported to the user.  The kernel
  69.  *    will translate its internal data structures to these structures
  70.  *    as appropriate.
  71.  *
  72.  */
  73.  
  74. #ifndef    _MACH_THREAD_INFO_H_
  75. #define _MACH_THREAD_INFO_H_
  76.  
  77. #import <mach/machine/vm_types.h>
  78. #import <mach/boolean.h>
  79. #import <mach/policy.h>
  80. #import <mach/time_value.h>
  81.  
  82. /*
  83.  *    Generic information structure to allow for expansion.
  84.  */
  85. typedef    integer_t    *thread_info_t;        /* varying array of ints */
  86.  
  87. #define THREAD_INFO_MAX        (1024)    /* maximum array size */
  88. typedef    integer_t    thread_info_data_t[THREAD_INFO_MAX];
  89.  
  90. /*
  91.  *    Currently defined information.
  92.  */
  93. #define THREAD_BASIC_INFO    1        /* basic information */
  94.  
  95. struct thread_basic_info {
  96.     time_value_t    user_time;    /* user run time */
  97.     time_value_t    system_time;    /* system run time */
  98.     integer_t    cpu_usage;    /* scaled cpu usage percentage */
  99.     integer_t    base_priority;    /* base scheduling priority */
  100.     integer_t    cur_priority;    /* current scheduling priority */
  101.     integer_t    run_state;    /* run state (see below) */
  102.     integer_t    flags;        /* various flags (see below) */
  103.     integer_t    suspend_count;    /* suspend count for thread */
  104.     integer_t    sleep_time;    /* number of seconds that thread
  105.                        has been sleeping */
  106. };
  107.  
  108. typedef struct thread_basic_info    thread_basic_info_data_t;
  109. typedef struct thread_basic_info    *thread_basic_info_t;
  110. #define THREAD_BASIC_INFO_COUNT    \
  111.         (sizeof(thread_basic_info_data_t) / sizeof(natural_t))
  112.  
  113. /*
  114.  *    Scale factor for usage field.
  115.  */
  116.  
  117. #define TH_USAGE_SCALE    1000
  118.  
  119. /*
  120.  *    Thread run states (state field).
  121.  */
  122.  
  123. #define TH_STATE_RUNNING    1    /* thread is running normally */
  124. #define TH_STATE_STOPPED    2    /* thread is stopped */
  125. #define TH_STATE_WAITING    3    /* thread is waiting normally */
  126. #define TH_STATE_UNINTERRUPTIBLE 4    /* thread is in an uninterruptible
  127.                        wait */
  128. #define TH_STATE_HALTED        5    /* thread is halted at a
  129.                        clean point */
  130.  
  131. /*
  132.  *    Thread flags (flags field).
  133.  */
  134. #define TH_FLAGS_SWAPPED    0x1    /* thread is swapped out */
  135. #define TH_FLAGS_IDLE        0x2    /* thread is an idle thread */
  136.  
  137. #define THREAD_SCHED_INFO    2
  138.  
  139. struct thread_sched_info {
  140.     integer_t    policy;        /* scheduling policy */
  141.     integer_t    data;        /* associated data */
  142.     integer_t    base_priority;    /* base priority */
  143.     integer_t    max_priority;   /* max priority */
  144.     integer_t    cur_priority;    /* current priority */
  145. /*boolean_t*/integer_t    depressed;    /* depressed ? */
  146.     integer_t    depress_priority; /* priority depressed from */
  147. };
  148.  
  149. typedef struct thread_sched_info    thread_sched_info_data_t;
  150. typedef struct thread_sched_info    *thread_sched_info_t;
  151. #define    THREAD_SCHED_INFO_COUNT    \
  152.         (sizeof(thread_sched_info_data_t) / sizeof(natural_t))
  153.  
  154. #endif    /* _MACH_THREAD_INFO_H_ */
  155.